<template>
<div class="box">
<div class="number">
  共有 <span>{{certInfo.length}}</span>个证书
</div>
  <div class="info-wrapper">

    <div class="info " v-for="(item,index) in certInfo" :key="index">
      <ul>
        <li>证书名称：<span v-text="item.CertName" class="overflow3 overflow32" >2019年度四川普通教育优秀成果一等奖</span></li></ul>
      <div class="f">
        <div class="info-left f1">
          <ul>
            <!--<li>证书名称：<span>2019年度四川普通教育优秀成果一等奖</span></li>-->
            <li>证书编号：<span v-text="item.Code" class="overflow3 " >1023456414564560256</span></li>
            <li>获奖作者：<span v-text="item.Author" class="overflow3 " >活力</span></li>
            <li>获奖单位：<span v-text="item.WorkUnitName" class="overflow3 " >成都石室中学</span></li>
            <li>获奖等级：<span v-text="item.Level" class="overflow3 " >一等奖</span></li>
            <li>发证日期：<span v-text="item.CertDate" class="overflow3 " >2019--8-22</span></li>
            <li>审核人员：<span v-text="item.reviewMan.split('(')[0]" class="overflow3 " >2019--8-22</span></li>
            <li>审核日期：<span v-text="item.reviewDate" class="overflow3 " >2019--8-22</span></li>
          </ul>
        </div>
        <div class="info-right f200 f-zhong" @click="cert_detail(item.Id)">
          <img :src="item.VideoThumb" alt="">
        </div>
      </div>

    </div>
  </div>
  <!--错误提醒-->
  <Prompt
    title="温馨提示"
    :msg=mistakeMsg
    confirm="确定"
    v-on:confirm1="confirm1($event)"
    v-if="mistake"
  >
  </Prompt>
</div>
</template>

<script>
  import Prompt from '@components/common/Prompt.vue'
    export default {
        name: "Cert",
      components:{
        Prompt
      },
      data(){
          return{
            mistakeMsg:'',
            mistake:false,
            certInfo:[]
          }
      },
      created(){
        this.get_myCert();
      },
      methods:{
        cert_detail(sn){
          // this.$router.push('/CertDetail?Id='+sn)
          let Server = "http://" + window.location.host + "/";
          window.open(Server + 'CertShow.html?id=' + sn+  '&dc=' + new Date().getTime())
          let me=this
          me.$Global.zcServer.Post({
            IsNeedLogin:'false',
            Paras:{
              Name:'Vue_Cert',
              Action:'doSetLastShowDate_Cert',
              UserId:me.$Global.UserId ,
              Data:{
                CertId: sn,
                organCode:'01'

              }
            },
            Callback:me.cb_myCertAdd,
            Scope:me
          });
        },
        get_myCert(){
          let me=this
          me.$Global.zcServer.Post({
            IsNeedLogin:'true',
            Paras:{
              Name:'Vue_CourseResource',
              Action:'PersonSert',
              UserId:me.$Global.UserId ,
              Data:{
                UserId:me.$Global.UserId
              }
            },
            Callback:me.cb_myCert,
            Scope:me
          });
        },
        cb_myCertAdd(resJson,scope){
          console.log("查看次数+1",resJson)
        },
        cb_myCert(resJson,scope){
          console.log('我的证书',resJson)
          if(resJson.success){
            this.certInfo=resJson.data
          }else {
          this.mistake=true
            if(resJson.msg.indexOf('PleaseRegistry')>=0){
              this.mistakeMsg="请先注册再查看证书！"
            }else {
              this.mistakeMsg=resJson.msg
            }

          }
        },
        confirm1(){
          this.mistake=false
        }
      }
    }
</script>

<style scoped>
  .number{
    height: 50px;
    line-height: 60px;
    padding-left: 5px;
  }
.number>span{
  color: orangered;
}
.info{
  background-color: #fff;
  padding: 10px 5px;
  margin-top: 10px;
}
  .info ul li{
    height: 24px;
    line-height: 24px;
    font-size: 14px;
    vertical-align: middle;
    color:#868686;
  }
  .info ul li span{
   color:black

  }
  .info-left ul li>span{
    display: inline-block !important;
  }
  .f200{
    width: 130px;
    margin-right: 5px;
  }
  .info-right>img{
    max-width: 140px;
  }
  .overflow3{
    display: inline-block;
    width: 150px !important;
    /*border: 1px solid;*/
    height: 24px;
    line-height: 35px;
  }
  .overflow32{
    display: inline-block;
    max-width: 270px !important;
    /*border: 1px solid;*/
  }
</style>
